// 单纯的模拟记得个接口
const express = require('express')
const app = express();

app.get('/api/course/list', (req, res) => {
  // 支持跨域调用
  // res.header('Access-Control-Allow-Origin', '*')
  // res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE')
  // res.header('Content-Type', "application/json;charset=utf-8")
  res.json({
    code: 0,
    list: [
      { name: "web小白", id: 1, },
      { name: "web高级", id: 2, },
      { name: "web全栈", id: 3, },
      { name: "web架构", id: 4, },
    ]
  })
})
app.get('/api/user/info', (req, res) => {
  // 支持跨域调用
  // res.header('Access-Control-Allow-Origin', '*')
  // res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE')
  // res.header('Content-Type', "application/json;charset=utf-8")
  res.json({
    code: 0,
    data: {
      name: "广联达",
      best: "我自己"
    }
  })
})
app.listen(9090, () => {
  console.log("接口启动成功！");
})